window.workspace = function(){
	var response  = <?#$respons?>;
	var store, grid;
	var sid = {'query':Ext.id(), 'executor':Ext.id(), 'status':Ext.id(),
		'tagid':Ext.id(), 'sdate':Ext.id(), 'edate':Ext.id(), 'issign':Ext.id()};
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url         : '/admin/live/basic/signer/dolist.html',
	    remoteSort	: true,
	    sortInfo	: {
            field		: 'jointime',
            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
	 	fields			: ['id', 'user', 'title', 'thumb', 'userid', 'olstatus', 'starlv', 'status',
	 	    'star', 'link', 'origin', 'avertime', 'averviewer', 'xfans', 'charms', 'salarycoins', 
	 	    'reports', 'lastcoins', 'earningcoins', 'jointime', 'realname', 'age', 'issign', 'signinfo',
	 	    'sex', 'signtime', 'salary', 'executor', 'livetime', 'slivetime', 'tags', 'events']
	});
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
	    columns		: [
			{header: '主播[Anchor]', width:110, sortable:true, dataIndex:'userid', renderer:function(v,meta,obj){
				return obj.get('user');
			}},
			{header: '标题[Title]', width:120, dataIndex:'title', renderer:function(v,meta,obj){
				return '<a href="'+obj.get('link')+'" target="_blank">'+v+'</a>';
			}},
			{header: '分类[Tags]', width:50, dataIndex:'tags'},
			{header: '状态[Status]', sortable:true, width:50, dataIndex:'status', renderer:function(v,meta,obj){
				return response.status[v];
			}},
			{header: '是否在线[IsLive]', sortable:true, width:50, dataIndex:'olstatus', renderer:function(v,meta,obj){
				return response.yes2no[v];
			}},
			{header: '粉丝数目[Fans]', sortable:true, width:50, dataIndex:'xfans'},
			{header: '魅力总计[Charms]', sortable:true, width:50, dataIndex:'charms'},
			{header: '星级[StarLv]', sortable:true, width:50, dataIndex:'starlv', renderer:function(v,meta,obj){
				return obj.get('star');
			}},
			{header: '是否签约[IsSign]', width:50, dataIndex:'issign', renderer:function(v,meta,obj){
				return response.yes2no[v];
			}},
			{header: '基础信息[Basic]', width:100, dataIndex:'realname', renderer:function(v,meta,obj){
				if(obj.get('issign') == 0) {
					return '';
				}
				var sex = obj.get('sex');
				var str = 'Name:'+obj.get('realname') + '/Age:' + obj.get('age')
					+ '/Sex:' + response.sex[sex] + '/SignDate:' + obj.get('signtime');
				return str;
			}},
			{header: '经纪人[Broker]', width:60, dataIndex:'executor'},
			{header: '时薪[Salary]', sortable:true, width:50, dataIndex:'salary'},
			{header: '直播时长[LiveTime]', sortable:true, width:60, dataIndex:'slivetime', renderer:function(v,meta,obj){
				return '<a href="'+obj.get('events')+'" target="_blank">'+obj.get('livetime')+'</a>';
			}},
			{header: '举报次数[Reports]', sortable:true, width:50, dataIndex:'reports'},
			{header: '礼物收益[Earning]', sortable:true, width:60, dataIndex:'earningcoins',renderer:function(v,meta,obj){
				return obj.get('earningcoins') - obj.get('salarycoins');
			}},
			{header: '可提现收益[BalanceCoins]', sortable:true, width:60, dataIndex:'lastcoins'},
			{header: '加入时间[JoinTime]',width:100, sortable:true, dataIndex:'jointime'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
		listeners	: {
	    	'destroy':function(){
    			win && win.close();
    		},'rowdblclick':function(grid, index, e){
		    	var link = grid.store.getAt(index).get('signinfo');
	    		try {
	    			main.openView(link);
	    		} catch(e) {
	    			window.open(link);
	    		}	
		    }
    	},
	    stripeRows	: true,
	    tbar		: [{
			text	: '刷新',
			iconCls	: 'icon-refresh',
			handler : function(){
				store.reload(); 
			}
	    },'-','标题/昵称:',{
			xtype       : 'textfield',
			id	    	: sid.query,
			width	    : 100
		},'经纪人:',{
			xtype       : 'textfield',
			id	    	: sid.executor,
			width	    : 80
		},'状态:',{
			xtype		: 'combo',
			store		: new Ext.data.ArrayStore({
		        fields: ['id','name'],
		        data: main.cv2Array(response.status)
		    }),
			displayField	: 'name',
			valueField		: 'id',
			mode			: 'local',
			triggerAction	: 'all',
			emptyText		: 'selected...',
			width			: 80,
			id  			: sid.status
		},'是否签约:',{
			xtype		: 'combo',
			store		: new Ext.data.ArrayStore({
		        fields: ['id','name'],
		        data: main.cv2Array(response.yes2no)
		    }),
			displayField	: 'name',
			valueField		: 'id',
			mode			: 'local',
			triggerAction	: 'all',
			emptyText		: 'selected...',
			width			: 80,
			id  			: sid.issign
		},'标签分类',{
			xtype		: 'combo',
			store		: new Ext.data.JsonStore({
				url	: '/admin/live/share/dotags.html',
				autoDestroy: true,
				fields: ['id', 'name'],
				root: 'dataset'
			}),
			id  			: sid.tagid,
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'selected...',
			minChars		: 1,
			 pageSize		: 10,
            listWidth		: 258,
            width	    	: 100,
			typeAhead		: true,
			typeAheadDelay  : 0,
			triggerAction	: 'all',
			enableKeyEvents : true,
			mode			: 'remote'
		},'-','加入时间[JoinTime]:',{
			xtype       : 'datefield',
			id  		: sid.sdate,
			format		: 'Y-m-d',
			width	    : 100
		},'<->',{
			xtype       : 'datefield',
			id  		: sid.edate,
			format		: 'Y-m-d',
			width	    : 100
		},'-',{
			text			: '检索[Search]',
			iconCls			: 'icon-search',
			handler: function() {
				store.baseParams.query    = Ext.getCmp(sid.query).getValue();
				store.baseParams.sdate    = Ext.getCmp(sid.sdate).getValue();
				store.baseParams.edate    = Ext.getCmp(sid.edate).getValue();
				store.baseParams.tagid    = Ext.getCmp(sid.tagid).getValue();
				store.baseParams.status   = Ext.getCmp(sid.status).getValue();
				store.baseParams.issign   = Ext.getCmp(sid.issign).getValue();
				store.baseParams.executor = Ext.getCmp(sid.executor).getValue();
				store.reload(); 
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();